# 家具类
class Furniture:
    def __init__(self, name, area):
        # 属性：家具名称、占地面积
        self.name = name
        self.area = area


# 房子类
class House:
    def __init__(self, address, area):
        # 属性：地理位置、占地面积、剩余面积、家具列表
        self.address = address
        self.area = area
        self.remainder_area = area
        self.furninture = []

    def __str__(self):
        return f'房子位置：{self.address},面积：{self.area},' \
               f'剩余面积：{self.remainder_area},家具列表：{self.furninture}'

    # 添置家具：当房子剩余面积大于家具面积时，房子添加家具：否则家具太大了
    def add_furniture(self,item):
        if self.remainder_area>=item.area:
            self.furninture.append(item)
            self.remainder_area-=item.area
        else:
            print('家具太大,放不下了！')


if __name__ == '__main__':
    # 创建房子对象
    my_house = House('学院路7号', 158)
    # 创建2个家具对象
    bed = Furniture('床', 20)
    ball = Furniture('足球场', 1208)
    # 往房子里添置家具
    my_house.add_furniture(bed)
    my_house.add_furniture(ball)
    # 打印查看房子对象信息
    print(my_house)